home *** CD-ROM | disk | FTP | other *** search
- /*******************************************\
- * file: PrintTitle.c *
- * version: 0.1ß *
- * XFCN ID 502 *
- * *
- * Print a title on the page. By definition *
- * titles are 1 line. Longer than that *
- * requires a call to Printparagraph *
- * *
- * params[0] == the string *
- * params[1] == the font *
- * params[2] == the size *
- * params[3] == the style *
- * params[4] == the justification *
- * ----------------------------------------- *
- * By: Donald Koscheka *
- * Date: 30-OCT-89 *
- * © Copyright 1989, Donald Koscheka *
- * All Rights Reserved *
- * *
- * ----------------------------------------- *
- \*******************************************/
-
- #include <MacTypes.h>
- #include <MemoryMgr.h>
- #include <ResourceMgr.h>
- #include <OSUtil.h>
- #include <HyperXCmd.h>
- #include <HyperUtils.h>
- #include <PrintMgr.h>
- #include "ReportUtils.h"
-
-
-
- pascal void main( paramPtr )
- XCmdBlockPtr paramPtr;
- /**********************************
- * params[0] == the text to print.
- * params[1] == the font
- * params[2] == the size
- * params[3] == the style
- * params[4] == the justification
- **********************************/
- {
- Handle pH;
- pInfoPtr pp;
- short theFont;
- short theSize;
- short theStyle;
- short theJust;
- long siz;
- char *fp1;
- char *fp2;
- char fontName[256];
- short hite;
- GrafPtr oldPort;
- FontInfo fInfo;
-
-
- if( paramPtr->paramCount && ( pH = GetSystemResource( PAGE_INFO, PAGE_ID ) ) ){
- pp = (pInfoPtr)*pH;
-
- /*** parse the input data ***/
- theFont = 4;
- theSize = 9;
- theStyle = 0;
- theJust = teJustLeft;
-
- if( paramPtr->params[1] ){
- paramtoPString( paramPtr, 1, (char *)fontName );
- GetFNum( fontName, &theFont );
- }
-
- if( paramPtr->params[2] )
- theSize = parseNum( *(paramPtr->params[2] ) );
-
- if( paramPtr->params[3] )
- theStyle = (short)matchToken( paramPtr->params[3], TEXT_STYLES );
-
- if( paramPtr->params[4] )
- theJust = (short)matchToken( paramPtr->params[4], TEXT_JUSTIFICATION );
-
- SetFont( (stylePtr)&(pp->curntStyle), theFont);
- SetFontSize( (stylePtr)&(pp->curntStyle), theSize);
- SetFontStyle( (stylePtr)&(pp->curntStyle), theStyle);
- SetFontJust( (stylePtr)&(pp->curntStyle), theJust);
-
- /* consider drawtextrun here */
- GetPort( &oldPort );
- SetPort( (GrafPtr)(pp->prPort) );
-
- PenNormal();
- SetFontStyles( pp, (stylePtr)&(pp->curntStyle) );
-
- GetFontInfo( &fInfo );
- hite = (fInfo.ascent + fInfo.descent + fInfo.leading);
-
- /*** use ( hite*4 ) to anticipate widows! ***/
- CheckPageBreak( pp, hite * 4 );
- PrintString( pp, paramPtr->params[0], hite );
-
- SetPort( oldPort );
- }
-
- paramPtr->returnValue = NIL;
- }
-
-
-